var obj = {
  name: 'why',
  age: 18
}

// 原型式继承函数
function createObject1(o) {
  var newObj = {}
  Object.setPrototypeOf(newObj, o)
  return newObj
}

function createObject2(o) {
  function Fn() {}
  Fn.prototype = o
  var newObj = new Fn()
  // newObj.__proto__ = o
  return newObj
}

var info = createObject2(obj)
console.log(info);
console.log(info.__proto__);


// 将obj作为info2的原型
var info2 = Object.create(obj)
console.log(info2.__proto__);